#include "Crossover.h"
#include <stdlib.h>
#include <time.h>

Crossover::Crossover()
{
	prob=0.5;
}

Crossover::Crossover(double p):prob(p)
{}

Crossover::~Crossover()
{}

void Crossover::run(vector<int>& case1, vector<int>& case2)
{
	int pInt=prob*10;
	srand(clock());
	if(rand()%10<pInt)
	{
		int crosspnt=rand()%case1.size();
		int tmp=case1[crosspnt];
		case1[crosspnt]=case2[crosspnt];
		case2[crosspnt]=tmp;
	}
}